package com.ruoyi.bzjgl.controller;

import com.ruoyi.bzjgl.domain.Bzjtable;
import com.ruoyi.bzjgl.domain.Kyktable;
import com.ruoyi.bzjgl.service.IBzjtableService;
import com.ruoyi.bzjgl.service.SeizureService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/seizure")
public class SeizureController extends BaseController {

    @Autowired
    private IBzjtableService bzjtableService;
    @Autowired
    private SeizureService seizureService;

    //可新增列表
    @GetMapping("/selectBzj")
    public TableDataInfo selectBzj(Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        List<String> list=seizureService.selectBzj(kyktable);
        return getDataTable(list);
    }

    //新增
    @PostMapping("/addSeizure")
    public AjaxResult addSeizure(@RequestBody Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        return toAjax(seizureService.addSeizure(kyktable));
    }
    //查询扣押列表
    @GetMapping("/kyList")
    public TableDataInfo kyList(Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        List<Kyktable> list=seizureService.kyList(kyktable);
        return getDataTable(list);
    }
    //删除扣押款
    @DeleteMapping("/{ky_bhs}")
    public AjaxResult delKy(@PathVariable Integer[] ky_bhs){
        startPage();
        return toAjax(seizureService.delKy(ky_bhs));
    }
    //修改扣押款信息
    @PostMapping("/updKy")
    public AjaxResult updKy(@RequestBody Kyktable kyktable){
        startPage();
        return toAjax(seizureService.updKy(kyktable));
    }
    //查询划拨扣押款列表
    @GetMapping("/hbList")
    public TableDataInfo hbList(Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        List<Kyktable> list=seizureService.hbList(kyktable);
        return getDataTable(list);
    }
    //扣押款划拨
    @PostMapping("/hbSeizure")
    public AjaxResult hbSeizure(@RequestBody Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        return toAjax(seizureService.hbSeizure(kyktable));
    }
    //查询没收扣押款列表
    @GetMapping("/msList")
    public TableDataInfo msList(Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        List<Kyktable> list=seizureService.msList(kyktable);
        return getDataTable(list);
    }
    //扣押款没收
    @PostMapping("/msSeizure")
    public AjaxResult msSeizure(@RequestBody Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        return toAjax(seizureService.msSeizure(kyktable));
    }
    //查询退还扣押款列表
    @GetMapping("/thList")
    public TableDataInfo thList(Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        List<Kyktable> list=seizureService.thList(kyktable);
        return getDataTable(list);
    }
    //扣押款退还
    @PostMapping("/thSeizure")
    public AjaxResult thSeizure(@RequestBody Kyktable kyktable){
        List<String> depNames = bzjtableService.getDepList();
        kyktable.setDepNames(depNames);
        startPage();
        return toAjax(seizureService.thSeizure(kyktable));
    }
}
